<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <script>
            /**
             * 3.改变 promise 状态和指定回调函数谁先谁后?
             * 两种情况都存在
             * 改变状态在前,  当执行器函数是『同步任务』,直接修改状态
             *
             * 指定回调在前, 当执行函数中是『异步任务, 在异步回调中修改状态』 (常用)
             */
            let p = new Promise((resolve, reject) => {
                setTimeout(() => {
                    console.log(222);
                    resolve("ok");
                }, 1000);
            });

            p.then((v) => {
                console.log(v);
            });
        </script>
    </body>
</html>
